package com.burgeon.extention.customer.service.impl;

import com.burgeon.extention.customer.dto.UserDto;
import com.burgeon.extention.customer.mapper.DemoUserMapper;
import com.burgeon.extention.customer.model.response.DemoUserResponseVo;
import com.burgeon.extention.customer.service.DemoService;
import nds.util.NDSException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class DemoServiceImpl implements DemoService {
    @Autowired
    private DemoUserMapper demoUserMapper;

    @Override
    public DemoUserResponseVo getUserById(Long id) throws NDSException{
        UserDto userDto = demoUserMapper.selectUserById(id);
        if (userDto == null){
            throw new NDSException("用户不存在");
        }
        DemoUserResponseVo responseVo = new DemoUserResponseVo();
        responseVo.setId(userDto.getId());
        responseVo.setName(userDto.getName());
        return responseVo;
    }
}
